<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>  
    <link rel="stylesheet" href="__PUBLIC__/css/pintuer.css">
    <link rel="stylesheet" href="__PUBLIC__/css/admin.css">
    <script src="__PUBLIC__/js/jquery.js"></script>
    <script src="__PUBLIC__/js/pintuer.js"></script>  
</head>
<body>
<form method="post" action="">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 留言管理</strong></div>
    <div class="padding border-bottom">
      <ul class="search">
        <li>
          <!-- <button type="button"  class="button border-green" id="checkall"><span class="icon-check"></span> 全选</button> -->
          <!-- <button type="submit" class="button border-red"><span class="icon-trash-o"></span> 批量删除</button> -->
        </li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="120">ID</th>
        <th>留言标题</th>       
        <th>留言人</th>
        <th>留言电话</th>
        <th>留言邮箱</th>
        <th width="30%">内容</th>
         <th>留言时间</th>
        <th>操作</th>       
      </tr>
      <volist name="data" id="vol">
        <tr>
          <td><input type="checkbox" name="id[]" value="1" />{$vol.id}</td>
          <td>{$vol.title}</td>
          <td>{$vol.name}</td>
          <td>{$vol.phone}</td>
          <td>{$vol.email}</td>           
          <td>{$vol.text}</td>
          <td>{$vol.time|date='Y-m-d',###}</td>
          <td>
              <a class="button border-main" href="__CONTROLLER__/feedbackReply/id/{$vol.id}"><span class="icon-edit"></span> 回复</a>
              <a class="button border-red" onclick="del(this)" id="{$vol.id}"><span class="icon-trash-o"></span> 删除</a>
          </td>
        </tr>
      </volist>    
      <tr>
        <td colspan="8"><div class="pagelist">{$show}</div></td>
      </tr>
    </table>
  </div>
</form>
<script type="text/javascript">

function del(obj){
  var res = confirm("您确定要删除吗?");
  if(res == true){
    var id = obj.id;
    $.post('__CONTROLLER__/feedbackDel/id/'+id,function(data){
      console.log(data);
      if(data == 1){
        alert('删除成功！');
        window.location.reload();
      }else{
        alert('删除失败！');
        window.location.reload();
      }   
    },'json'); 
  }
}

$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false; 		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

</script>
</body></html>